<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="https://og6593g2z.qnssl.com/fundebug.0.3.3.min.js"
            apikey="f425f662987ebb7ba8943b7db3a296603e9d5a91ad9fefd25f16a1923106bf9a"></script>
    <script src="__LAYUI__/layui.js"></script>
    <link href="__LAYUI__/css/layui.css" rel="stylesheet"/>
    <title>Title</title>
</head>
<body>

<div style="width: 100%;height: 30px">
    <div style="float: right">

        <button class="layui-btn layui-btn-normal" id="magazineInsert">新增</button>
        <button class="layui-btn layui-btn-danger" id="magazineDel">删除</button>
    </div>
</div>

<table id="magazine" lay-filter="text"></table>

<script>
    layui.use(['table', 'jquery','layer'], function () {
        var table = layui.table
            , $ = layui.$
            ,layer = layui.layer;


        table.render({
            elem: '#magazine'
            , page: true
            , limit: 10
            , cols: [[
                {field: 'Id', title: 'ID', width: 100},
                {field: 'name', title: '名称', width: 200},
                {field: 'circle', title: '操作周期/月', width: 150},
                {field: 'price', title: '参考价格', width: 100},
                {field: 'remark',event:'showRemark', title: '备注', width: 500}
            ]]
            , id: 'magazine'
            , url: '/index/Magazine/getMagazine'
            , response: {
                statusCode: 1
            }
        });
        table.on('tool(text)', function (obj) {
            var data = obj.data;
            if (obj.event === 'showRemark') {
                layer.open({
                    title:'备注',
                    offset: 't',
                    type: 0,
                    content: data.remark,
                });
            }
        });

        $('#magazineInsert').click(function () {

            layer.open({
                type: 2,
                offset: '0px',
                title: '新增期刊',
                scrollbar: false,
                resize: false,
                area: ['600px', '570px'],
                shadeClose: true,
                content: ['/index/Magazine/insertMagazine', 'no'],
            });
        });

        $('#magazineDel').click(function () {
            layer.open({
                type: 2,
                offset:'100px',
                title: '删除',
                scrollbar: false,
                resize: false,
                area:['900px','380px'],
                shadeClose: true,
                content: ['/index/Magazine/magazineMe','no'],
                end:function () {
                    table.reload('magazine', {});
                }
            });
        });

    });
</script>

</body>
</html>